﻿using System.Collections.ObjectModel;
using TrafficCountingTool.Models;

namespace TrafficCountingTool.ViewModel
{
    public class SettingWindowViewModel : ViewModel
    {
        private ObservableCollection<VehicleCounting> _vehicleCountings;

        public ObservableCollection<VehicleCounting> VehicleCountings
        {
            get { return _vehicleCountings; }
            set
            {
                _vehicleCountings = value;
                SetProperty(ref _vehicleCountings, value);
            }
        }

        public void Init(AppCache appCache)
        {
            if (VehicleCountings == null)
            {
                VehicleCountings = new ObservableCollection<VehicleCounting>();
            }

            foreach (var vehicleCounting in appCache.VehicleCountings)
            {
                VehicleCountings.Add(vehicleCounting);
            }
        }
    }
}